package com.iplant.pdm.serviceImpl.dao.mss;

import com.iplant.base.po.OutResult;
import com.iplant.base.po.Pagination;
import com.iplant.base.utils.annotation.dao.DBBaseDAO;
import com.iplant.base.utils.sql.BaseDAO;
import com.iplant.basic.service.po.bms.BMSEmployee;
import com.iplant.pdm.service.po.mss.MSSBOMItem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@DBBaseDAO(MSSBOMItem.class)
public class MSSBOMItemDAO extends BaseDAO {

    private static Logger logger = LoggerFactory.getLogger(MSSBOMItemDAO.class);
    private static MSSBOMItemDAO Instance = null;

    private MSSBOMItemDAO() {
        super("");
        this.Init();
    }

    public static MSSBOMItemDAO getInstance() {
        if (Instance == null)
            Instance = new MSSBOMItemDAO();
        return Instance;
    }

    public List<MSSBOMItem> MSS_SelectBOMItemByRouteID(BMSEmployee wLoginUser, int wRouteID, Pagination wPagination, OutResult<Integer> wErrorCode) {

        if (wRouteID <= 0)
            return new ArrayList<>();
        Map<String, Object> wParams = new HashMap<>();
        wParams.put("RouteID", wRouteID);
        return this.SelectPOList(wLoginUser, wParams, wPagination, wErrorCode);
    }


    public List<MSSBOMItem> MSS_SelectBOMItemByRouteID(BMSEmployee wLoginUser, int wRouteID, int wRoutePartID, int wRoutePartPointID, Pagination wPagination, OutResult<Integer> wErrorCode) {

        if (wRouteID <= 0 && wRoutePartID <= 0 && wRoutePartPointID <= 0)
            return new ArrayList<>();
        Map<String, Object> wParams = new HashMap<>();
        wParams.put("RouteID", wRouteID);
        wParams.put("RoutePartID", wRoutePartID);
        wParams.put("RoutePartPointID", wRoutePartPointID);
        return this.SelectPOList(wLoginUser, wParams, wPagination, wErrorCode);
    }


}
